import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path:'/',
       redirect:'/login',
    },
    {
      path: '/login',
      component:() => import('../views/login.vue')
    },
    {
      path: '/my',
      component: () => import('../views/my.vue')
    },
    {
      path: '/manage',
      component:() => import('../views/ManageYouHuiJuan.vue')
    },
    {
      path: '/xinzeng',
      component:() => import('../views/addYouHuiJuan.vue')
    },
    {
      path: '/double',
      component:() => import('../views/doubleCan.vue')
    },
    {
      path: '/chakan',
      component:() => import('../views/chakanData.vue')
    },
    {
      path: '/hexiao',
      component:()=> import('../views/hexiaoYouHuiJuan.vue')
    },
    {
      path: '/Detail',
      component:() => import('../views/UserDetail.vue')
    },
    {
      path: '/secretcoupons',
      component:() => import('../views/SeeSecretCoupons.vue')
    }
    // {
    //   path: '/',
    //   component: HouseLayout,
    //   redirect: '/article',
    //   children: [
    //     { path: '/article', component: HouseArticle },
    //     { path: '/find', component: HouseFind },
    //     { path: '/detail', component: HouseDetail },
    //     { path: '/user', component: HouseUser }
    //   ]
    // }
  ]
})
// const whiteList = ['/login', '/register', '/user']
// router.beforeEach((to, from, next) => {
//   console.log(to)
//   const token = getToken()
//   console.log(token)
//   if (token) {
//     next()
//   } else {
//     if (whiteList.includes(to.path)) {
//       next()
//     } else {
//       next('/login')
//     }
//     // this.state = '去登陆'
//     // this.$router.push('/login')
//   }
// })

export default router
